Mapping non-generic markup language elements to generic object-oriented programming language objects

ABSTRACT

A system extends functionality of Java architecture for XML (extensible markup language) binding, (JAXB). Represents non-generic elements of a markup language (for example, XML) document in an object oriented programming language (for example, Java). The elements are represented as objects in the programming language. Objects are changed in the programming language representation and the original markup language document is then updated with updated objects translated back as updated elements of the document. The entire document infoset is preserved.

BACKGROUND

The present invention relates generally to the field of mapping markuplanguage content to “objects” (that is, a location in memory having avalue and typically referenced by an identifier).

XML, which stands for eXtensible Markup Language, is a markup language.Typically, XML documents are machine-readable, and also typicallyreasonably human-readable. An XML infoset typically includes all theinformation contained within the XML file including spacing, comments,elements, attributes, and data. While all of the machine-readableinformation typically remains within elements and element attributes,valid XML may still have comments which can make the files morehuman-readable. An XML Schema is a way to describe a certain type of XMLdocument. The XML Schema acts as a set of constraints that an XMLdocument can be validated against. The process of validating an XMLdocument against an XML Schema is separate from the XML document beingwell-formed. A well-formed XML document conforms to all the rules ofXML. Typically, well-formed XML documents can be validated against someXML Schema when the XML Schema is specific enough.

SUMMARY

According to an aspect of the present invention, there is a method,computer program product and/or system that performs the followingoperations (not necessarily in the following order): (i) receiving (a) afirst information dataset in the form of a markup language file, thefirst information dataset including a first plurality of related elementnodes, and (b) a set of change(s) to be made to the first informationdataset; (ii) generating (a) a first plurality of related objects, in anobject oriented programming language, corresponding to the firstplurality of related element nodes, and (b) a set of link informationthat links the objects of the first plurality of related objects torespectively corresponding element nodes in the first plurality ofrelated element nodes; (iii) making the set of change(s) to the firstplurality of related objects using the object oriented programminglanguage to create a revised first plurality of related objects; and(iv) making the set of change(s) to the first plurality of relatednodes, in the markup language file, based on the revised first pluralityof related objects and the set of link information.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram view of a first embodiment of a systemaccording to the present invention;

FIG. 2 is a flowchart showing a first embodiment method performed, atleast in part, by the first embodiment system;

FIG. 3 is a block diagram showing a machine logic (for example,software) portion of the first embodiment system;

FIG. 4 is a tree diagram showing information that is helpful inunderstanding embodiments of the present invention; and

FIG. 5 is a tree diagram showing information that is helpful inunderstanding embodiments of the present invention.

DETAILED DESCRIPTION

A markup language (for example, XML) document is parsed, in an objectoriented programming language (for example, Java), into document objectmodel (DOM) nodes. The document is unmarshaled (for example, by callingJava architecture for XML binding, (JAXB) on the root element). Javaobjects are used to represent non-generic XML elements. Each DOM node isassociated with a Java object so as to preserve the mapping of DOM nodesto the document. The XML document is preserved otherwise. Extendsfunctionality of JAXB, gives greater ability to use object-orienteddesign principles, and provides greater flexibility when mapping XMLelements to Java objects. This Detailed Description section is dividedinto the following sub-sections: (i) The Hardware and SoftwareEnvironment; (ii) Example Embodiment; (iii) Further Comments and/orEmbodiments; and (iv) Definitions.

I. THE HARDWARE AND SOFTWARE ENVIRONMENT

The present invention may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

An embodiment of a possible hardware and software environment forsoftware and/or methods according to the present invention will now bedescribed in detail with reference to the Figures. FIG. 1 is afunctional block diagram illustrating various portions of networkedcomputers system 100, including: server sub-system 102; document server104; information server 106; communication network 114; server computer200; communication unit 202; processor set 204; input/output (I/O)interface set 206; memory device 208; persistent storage device 210;display device 212; external device set 214; random access memory (RAM)devices 230; cache memory device 232; and translation program 300.

Sub-system 102 is, in many respects, representative of the variouscomputer sub-system(s) in the present invention. Accordingly, severalportions of sub-system 102 will now be discussed in the followingparagraphs.

Sub-system 102 may be a laptop computer, tablet computer, netbookcomputer, personal computer (PC), a desktop computer, a personal digitalassistant (PDA), a smart phone, or any programmable electronic devicecapable of communicating with the client sub-systems via network 114.Translation program 300 is a collection of machine readable instructionsand/or data that is used to create, manage and control certain softwarefunctions that will be discussed in detail, below, in the ExampleEmbodiment sub-section of this Detailed Description section.

Sub-system 102 is capable of communicating with other computersub-systems via network 114. Network 114 can be, for example, a localarea network (LAN), a wide area network (WAN) such as the Internet, or acombination of the two, and can include wired, wireless, or fiber opticconnections. In general, network 114 can be any combination ofconnections and protocols that will support communications betweenserver and client sub-systems.

Sub-system 102 is shown as a block diagram with many double arrows.These double arrows (no separate reference numerals) represent acommunications fabric, which provides communications between variouscomponents of sub-system 102. This communications fabric can beimplemented with any architecture designed for passing data and/orcontrol information between processors (such as microprocessors,communications and network processors, etc.), system memory, peripheraldevices, and any other hardware components within a system. For example,the communications fabric can be implemented, at least in part, with oneor more buses.

Memory 208 and persistent storage 210 are computer-readable storagemedia. In general, memory 208 can include any suitable volatile ornon-volatile computer-readable storage media. It is further noted that,now and/or in the near future: (i) external device(s) 214 may be able tosupply, some or all, memory for sub-system 102; and/or (ii) devicesexternal to sub-system 102 may be able to provide memory for sub-system102.

Translation program 300 is stored in persistent storage 210 for accessand/or execution by one or more of the respective computer processors204, usually through one or more memories of memory 208. Persistentstorage 210: (i) is at least more persistent than a signal in transit;(ii) stores the program (including its soft logic and/or data), on atangible medium (such as magnetic or optical domains); and (iii) issubstantially less persistent than permanent storage. Alternatively,data storage may be more persistent and/or permanent than the type ofstorage provided by persistent storage 210.

Translation program 300 may include both machine readable andperformable instructions and/or substantive data (that is, the type ofdata stored in a database). In this particular embodiment, persistentstorage 210 includes a magnetic hard disk drive. To name some possiblevariations, persistent storage 210 may include a solid state hard drive,a semiconductor storage device, read-only memory (ROM), erasableprogrammable read-only memory (EPROM), flash memory, or any othercomputer-readable storage media that is capable of storing programinstructions or digital information.

The media used by persistent storage 210 may also be removable. Forexample, a removable hard drive may be used for persistent storage 210.Other examples include optical and magnetic disks, thumb drives, andsmart cards that are inserted into a drive for transfer onto anothercomputer-readable storage medium that is also part of persistent storage210.

Communications unit 202, in these examples, provides for communicationswith other data processing systems or devices external to sub-system102. In these examples, communications unit 202 includes one or morenetwork interface cards. Communications unit 202 may providecommunications through the use of either or both physical and wirelesscommunications links. Any software modules discussed herein may bedownloaded to a persistent storage device (such as persistent storagedevice 210) through a communications unit (such as communications unit202).

I/O interface set 206 allows for input and output of data with otherdevices that may be connected locally in data communication with servercomputer 200. For example, I/O interface set 206 provides a connectionto external device set 214. External device set 214 will typicallyinclude devices such as a keyboard, keypad, a touch screen, and/or someother suitable input device. External device set 214 can also includeportable computer-readable storage media such as, for example, thumbdrives, portable optical or magnetic disks, and memory cards. Softwareand data used to practice embodiments of the present invention, forexample, translation program 300, can be stored on such portablecomputer-readable storage media. In these embodiments the relevantsoftware may (or may not) be loaded, in whole or in part, ontopersistent storage device 210 via I/O interface set 206. I/O interfaceset 206 also connects in data communication with display device 212.

Display device 212 provides a mechanism to display data to a user andmay be, for example, a computer monitor or a smart phone display screen.

The programs described herein are identified based upon the applicationfor which they are implemented in a specific embodiment of theinvention. However, it should be appreciated that any particular programnomenclature herein is used merely for convenience, and thus theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

II. EXAMPLE EMBODIMENT

FIG. 2 shows flowchart 250 depicting a method according to the presentinvention. FIG. 3 shows translation program 300 for performing at leastsome of the method operations of flowchart 250. This method andassociated software will now be discussed, over the course of thefollowing paragraphs, with extensive reference to FIG. 2 (for the methodoperation blocks) and FIG. 3 (for the software blocks).

Processing begins at operation 5255, where communications module (“mod”)302, of translation program 300, receives an original XML infoset (notseparately shown in the figures) from document server 104 of FIG. 1, andfurther receives a required update data set (not separately shown in thefigures) from information server 106 of FIG. 1. The required update dataset includes information pertaining to data, included in the XMLinfoset, that are to be updated. In some embodiments, the requiredupdate data set is determined programmatically. In some embodiments, theupdate data set includes information derived from: (i) real-time sensordata; (ii) telemetry data transmitted from moving vehicles; (iii)automobile traffic data derived from camera images and roadway sensordata; (iv) air traffic control data derived from radar and othertelemetry data; (v) medical data; (vi) research data; (vii) cellphonenetwork data; (viii) commodity pricing data; (ix) crime data; and/or (x)any other type of data that can be included in an XML-type file.

Processing proceeds to operation 5260, where mapping module 304, oftranslation program 300, parses data in the XML file and createsrespective JAVA objects where any type of XML node can be represented asany type of JAVA object in a way that preserves the mapping back to theoriginal XML document. Each node in the XML infoset is mapped to a Javaobject. The interrelationships between the JAVA objects correspond tothe interrelationships between the nodes in the XML infoset such thatthere is a one-to-one correspondence between JAVA objects and XML nodes.Module 304 further dynamically links each JAVA object to its respectiveXML node.

Processing proceeds to operation 5265, where updating module 306, oftranslation program 300, updates some of the JAVA objects in accordancewith the required update data set.

Processing proceeds to operation 5270 where communications module 302,of translation program 300, updates the XML infoset in accordance withthe updated JAVA objects, such that the updates indicated in therequired update data set are applied to the original XML infoset.

III. FURTHER COMMENTS AND/OR EMBODIMENTS

Some embodiments of the present invention may include one, or more, ofthe following features, characteristics and/or advantages: (i) mapnon-generic XML (extensible markup language) elements to generic Javaobjects (note: the term “JAVA” may be subject to statutory and/or commonlaw trademark protection in various jurisdictions throughout the world);(ii) handles situations where there are XML documents which do notcorrespond to a stable XML Schema but it is desired to be able tomanipulate the elements of the XML document as Java objects and thenapply our updates back to the original XML file without losing theinfoset; (iii) provides a tool which allows for this type of XML elementto have performed on it Java object binding of elements if the elementsdo not share a common name; (iv) allows XML element mapping in a waythat does not involve writing new code every time the schema or XMLchanges; and/or (v) relatively non-error-prone.

Some embodiments of the present invention may include one, or more, ofthe following features, characteristics and/or advantages: (i) allowsfor someone to manipulate all XML element nodes, including non-genericnamed XML elements, as any types of generic Java objects and then applythe changes back to an XML file by creating a dynamic association of thechild element XML nodes of an element to the parent element; (ii) unlikein JAXB (Java Architecture for XML Binding) where all XML element namesmust correspond to a class, allows for any XML node to be created as anykind of Java object in a way that preserves the mapping back to theoriginal XML document; and/or (iii) leads to simpler and/or moreabstract ways to handle XML data as Java objects without losinginformation from the XML document.

In one embodiment of a method according to the present disclosure: (i)receive a well-formed XML document; (ii) parse the document in Java intoDOM (document object model) nodes; (iii) call the JAXB binder on theroot element to unmarshal the document; and (iv) map any other elementsusing either the existing JAXB annotation methods or methods accordingto the present disclosure throughout the document. Normally, withannotated classes for each XML element, operation (iii), above, would bethe last step before modifying the document. Here, in this methodembodiment, there are not annotated classes. Instead, a Java object iscreated, and can be used to represent non-generic XML elements. Throughthis method embodiment, each DOM node is associated to the Java objectthat was created in a way that preserves the mapping of DOM nodes to thedocument. A potential advantage to using the JAXB binder is that allchanges are made in a way such that the XML document is preserved. Thismethod embodiment provides extended functionality on the JAXB binder,giving greater ability to use Object-Oriented design principles andproviding more flexibility when doing the mapping of the XML elements toJava objects.

Consider the following example XML document:

<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?>

<root_element attribute_1=“text” attribute2=“text”>

<!--COMMENT-->

<!--Another Comment-->

<type><!--comment-->

<PREFIX_DEF><!--comment-->

<a attribute_a=“lorem” attribute_b=“ipsum”/><!--comment-->

<a attribute_a=“dolor” attribute_b=“sit”/><!--comment-->

</PREFIX_DEF>

<PREFIX_GHI>

-   -   <a attribute_a=“amet” attribute_b=“consetetur”/><!--comment-->    -   <a attribute_a=“sadipscing” attribute_b=“elitr”/>    -   <a attribute_a=“sed” attribute_b=“diam”/><!--comment-->

</PREFIX_GHI>

<PREFIX_ABC>

<a attribute_a=“nonumy” attribute_b=“eirmod”/>

</PREFIX_ABC>

</type>

The above XML document has a human-readable pattern with commentssprinkled throughout. While this XML may not be ideal in terms of designit still conforms to all the rules of XML to make it valid. In thisexample, it is desired to manipulate all of the “a” elements Javaobjects and to apply the changes back to this original XML document.Programmatically, in this example, the logical approach to this would beto manipulate each “a” element's attributes where each “a” element couldbe accessed through its parent element. In this case, all parentelements have a common prefix but the element names are all different.Under current versions of JAXB this becomes an issue. Specifically, inJAXB, the following Java classes would be required:

type.class

PREFIX_DEF.class

PREFIX_GHI.class

PREFIX_ABC.class

a.class

Some embodiments of the present invention avoid the issue of having aunique class for every single PREFIX_*** element. Needing to modify thecode every time there is a new tag is a clumsy solution that takes a lotof unnecessary time and is very error prone. A programmatic solution, isto allow for the following: every child element of a given XML element,including the root element, can be associated to a specified Javaobject, with the mapping to the XML node preserved.

A method according to the present disclosure includes the followingoperations: (i) the callback function is registered to be invoked whenthe specified element is being parsed (the specific element could beeither annotated as @XmlAnyElement or an XML XPath); (ii) an interfacewhich defines the conversion from any non-specific XML node to aspecific Java object and vice versa; (iii) the internal map between theabstract XML node and the Java Object; (iv) once the callback functionis invoked, it will traverse the element and calls the interface tocreate the concrete Java object; (v) the newly created Java object isthen put into the internal map; (vi) the users finish updating the Javaobject; and (vii) the internal map is used to update the abstract XMLnode which is used to generate the final XML file.

In the method of the preceding paragraph, there are only the followingclasses:

type.class

PREFIX.class

a.class

In this method, any update to the XML file or schema which involvesadding another element under type does not require any change to ourcode.

As shown in FIG. 4, XML layout diagram 400 includes: root element 402;element 404; child element_1 406; child element_2 408; child element_3410; child_1 412; child_2 414; child_3 416; child_4 418; name 430; age432; SSN 434; unmapped_1 450; unmapped_2 452; and unmapped_3 454.Elements of the XML layout diagram are organized in a tree structure.

Based on the XML layout diagram 400, the above-described methods achieveJava representation diagram 500, which includes: root object 502;element object 504; method getProperties( ) 506; method getProperties( )508; method getProperties( ) 510; method getProperties( ) 512; methodgetProperties( ) 514; method getProperties( ) 516; method getProperties() 518; name object 530; age object 532; and SSN object 534. Objects ofthe Java representation diagram are organized in a tree structureanalogous to elements in XML layout diagram 400.

Diagram 400 shows the tree structure of an XML document. Diagram 500shows the corresponding Java object hierarchy achieved by methodsaccording to the present disclosure.

IV. DEFINITIONS

XML infoset/infoset: An XML information set. The entire contents of anXML file including: (i) the document information item (always present);(ii) element information items; (iii) attribute information items; (iv)processing instruction information items; (v) unexpanded entityreference information items; (vi) character information items; (vii)comment information items; (viii) the document type declarationinformation item; (ix) unparsed entity information items; (x) notationinformation items; and/or (xi) namespace information items.

Present invention: should not be taken as an absolute indication thatthe subject matter described by the term “present invention” is coveredby either the claims as they are filed, or by the claims that mayeventually issue after patent prosecution; while the term “presentinvention” is used to help the reader to get a general feel for whichdisclosures herein are believed to potentially be new, thisunderstanding, as indicated by use of the term “present invention,” istentative and provisional and subject to change over the course ofpatent prosecution as relevant information is developed and as theclaims are potentially amended.

Embodiment: see definition of “present invention” above—similar cautionsapply to the term “embodiment.”

and/or: inclusive or; for example, A, B “and/or” C means that at leastone of A or B or C is true and applicable.

Including/include/includes: unless otherwise explicitly noted, means“including but not necessarily limited to.”

Receive/provide/send/input/output/report: unless otherwise explicitlyspecified, these words should not be taken to imply: (i) any particulardegree of directness with respect to the relationship between theirobjects and subjects; and/or (ii) absence of intermediate components,actions and/or things interposed between their objects and subjects.

Module/Sub-Module: any set of hardware, firmware and/or software thatoperatively works to do some kind of function, without regard to whetherthe module is: (i) in a single local proximity; (ii) distributed over awide area; (iii) in a single proximity within a larger piece of softwarecode; (iv) located within a single piece of software code; (v) locatedin a single storage device, memory or medium; (vi) mechanicallyconnected; (vii) electrically connected; and/or (viii) connected in datacommunication.

Computer: any device with significant data processing and/or machinereadable instruction reading capabilities including, but not limited to:desktop computers, mainframe computers, laptop computers,field-programmable gate array (FPGA) based devices, smart phones,personal digital assistants (PDAs), body-mounted or inserted computers,embedded device style computers, application-specific integrated circuit(ASIC) based devices.

What is claimed is:
 1. A computer-executed method comprising: receiving:a first information dataset in the form of a markup language file, thefirst information dataset including a first parent node and a firstplurality of related element nodes, and a set of change(s) to be made tothe first information dataset; generating: a first plurality of relatedobjects, in an object oriented programming language, corresponding tothe first plurality of related element nodes, and a set of linkinformation that links the objects of the first plurality of relatedobjects to respectively corresponding element nodes in the firstplurality of related element nodes; making the set of change(s) to thefirst plurality of related objects using the object oriented programminglanguage to create a revised first plurality of related objects; makingthe set of change(s) to the first plurality of related nodes, in themarkup language file, based on the revised first plurality of relatedobjects and the set of link information; mapping a non-generic elementof the markup language file to an object in a generic object-orientedprogramming language; parsing the markup language file into at least onedocument object model node; associating a document object model node toa generic programming language object; and preserving mapping of adocument object node to an element of the markup language file.